Removed hard-coded logic for electrolyzer replacement schedule#555
Open
elenya-grant wants to merge 9 commits intoNatLabRockies:developfrom
Open
Removed hard-coded logic for electrolyzer replacement schedule#555elenya-grant wants to merge 9 commits intoNatLabRockies:developfrom
elenya-grant wants to merge 9 commits intoNatLabRockies:developfrom
Conversation
…chedule for transport components
jaredthomas68
requested changes
Feb 27, 2026
Collaborator
jaredthomas68
left a comment
There was a problem hiding this comment.
This looks pretty good to me. Thanks for continuing to generalize and reduce tech-specific logic. My main thoughts are as follows:
- Let's allow for costs for transport techs (needed in current project)
- I don't love having costs or replacement schedule in feedstocks, but if the user does not need to do anything with them then I think it is ok if keeps things more general.
jaredthomas68
approved these changes
Mar 2, 2026
Collaborator
jaredthomas68
left a comment
There was a problem hiding this comment.
Looks good to me now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed hard-coded logic for electrolyzer replacement schedule
Removed the hard-coded logic within the finance models and H2IntegrateModel that was specific to connecting the replacement schedule from the technology to a finance model if a technology name included "electrolyzer". Now - the replacement schedule is passed to the finance models for all technologies.
Note: This is ready for an in-depth review, but I have noted some specific questions for reviewers in Section 2 under "Type of Reviewer Feedback Requested"
Since technology-specific finance models do not expect the electrolyzer replacement schedule to be connected, there is some added logic to handle tech-specific finance models (before, the logic was not explicit and relied on whether the
commodity_streamfor a finance subgroup was None. This logic has been replaced with more explicit logic. Additionally, since this logic is handled/defined at the subgroup-level, it is not possible to have a finance subgroup that includes finance_groups that have a mix of technology-specific and finance specific models (this has always been the case). Further information on this is described in Section 5. But - I added in an error message to catch this case if it were to pop up.This also required updating the feedstock cost model to output a replacement schedule. An alternative to adding this output to the feedstock cost model would be to add in logic to
connect_technologiesthat checks if 'feedstock' is in the technology name (this alternative approach was the route taken for transport technologies).I also added a documentation page about the technology naming convention in H2I to communicate what naming convention is requires so that the logic within H2I functions as expected.
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
replacement_scheduleor should we introduce logic intoconnect_technologiesso that technologies withfeedstockin the name do not have the replacement schedule passed to the finance model? This logic would maybe have to be duplicated in the finance models if so. I like the current implementation since it reduces the amount of naming-specific logic in the code base.Other feedback:
default_techs_to_commoditiesdictionary inH2IntegrateModel.create_finance_model()) be described in thedocs/user_guide/expected_naming_convention.mddoc page?Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.mdhas been updated to describe the changes made in this PRSection 3: Related Issues
This is somewhat related to Issue #485
Section 4: Impacted Areas of the Software
Section 4.1: New Files
docs/user_guide/expected_naming_convention.md: new doc page that explains what naming convention is needed for technologies in H2I so that it functions properlySection 4.2: Modified Files
h2integrate/finances/profast_base.py-ProFastBase: removed logic around electrolyzer replacement schedule, added input for all replacement schedule for all technologies, and updated replacement schedule calculation to useinputs['replacement_schedule_{tech}']instead of time between replacement.examples/08_wind_electrolyzer/user_finance_model/simple_lco.py: added input of technology replacement schedulesh2integrate/finances/numpy_financial_npv.py-NumpyFinancialNPV: removed logic around electrolyzer replacement schedule, added input for all replacement schedule for all technologies, and updated replacement schedule calculation to useinputs['replacement_schedule_{tech}']instead of time between replacement.h2integrate/core/feedstocks.py: addedreplacement_scheduleoutput toFeedstockCostModelh2integrate/core/h2integrate_model.py:create_finance_model():system_finance_modelkey to thefinance_subgroupsdictionary. This is a boolean that is True if the finance model is system-level and False if the finance model is tech-specific.n_tech_finances_in_groupthat is equal to the number of technology-specific finance models within a finance subgroup. This is used so that later on, we can throw an error message if someone has a mix of technology-specific finance models and system-level finance models within one finance subgroup.connect_technologies()elifstatement forelif "storage" in source_techandelif "storage" in dest_techbecause it was the same logic that is done in theelsestatement and was therefore unnecessary.if commodity_stream is not Nonetoif is_system_finance_modelwhich is pulled from thefinance_subgroupsattribute that is created increate_finance_model()is_system_finance_modelis True andtech_namedoes not include "transport".h2integrate/core/test/test_framework.py: added new test,test_invalid_finance_group_combination, for error message addedSection 5: Additional Supporting Information
Suppose we have a technology-specific finance model for the
steeltechnology and a system-level finance model namedprofast_model(as is the case in Example 1). If a user tried to run both of these finance models as shown below:there would be an error (this PR now includes a more verbose error than the error that would've occurred when trying to run H2I).
The user should instead define two finance subgroups, one per finance model.
This error does not come up if finance models defined in the
finance_groupsfor a specific finance subgroup are either all tech-specific finance models OR all system-level finance models (see example 8).Section 6: Test Results, if applicable